OpenRoads Designer CONNECT Edition SDK Help

Add new station point in corridor key station

In corridor creation, Station is a point which is X distance along the corridor. To add a new station in corridor key station, the below code snippet shows how this is achieved.

Example


internal bool AddKeyStation(Corridor corridor)
        {  
            Bentley.GeometryNET.DPoint3d point = new DPoint3d(707255.9392, 231716.2140, 0);
            Bentley.CifNET.LinearGeometry.LinearElement corridorAlignmentCurve = corridor.
CorridorAlignment.LinearGeometry;
            if (corridorAlignmentCurve == null)
                return false;
            //Get distance for adding station to corridor 
            Bentley.CifNET.LinearGeometry.LinearPoint linePoint = corridorAlignmentCurve.
ProjectPointOnPerpendicular(point);
            double distanceAlong = linePoint.DistanceAlong;

            //Add new station to corridor
            KeyStation newKeyStation = corridor.AddKeyStation(distanceAlong);
            if (newKeyStation == null)
                return false;

            return true;
        }

Corridor.AddKeyStation() adds a new KeyStation to the corridor